package com.asialjim.wechat.official.message.output.media;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: Articles ]</i></h2><strong>
 * <p> we-chat article list
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 * @author Asial Jim &nbsp;&nbsp; <span>Email: &nbsp;&nbsp; <a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @since 2021/3/8   &nbsp;&nbsp; JDK 8
 * @version 1.0.0
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Articles {

    /**
     * 使用Object类型，而非List类型为了绕开xml序列化时出现<item><item>**</item><item>***</item></item>而非<item></item><item></item>的情况
     */
//    @JsonProperty(value = "item")
    @JacksonXmlProperty(localName = "item")
    private Object articles;

    @JsonIgnore
    private List<Article> item;

    public Articles(List<Article> articles) {setArticles(articles);}
    private void setArticles(List<Article> articles){ this.articles = articles;}
    private void setItem(){}

    public List<Article> getItem(){ return (List<Article>)articles;}
}
